window.addEvent('domready', function(){
   if($('tabs-nav')!= null){
	$('tabs-nav').getElements('a').each(function(i) {
		i.addEvent('click', function(event){
			event.stop();
			ids = i.get('id').split("_");
			//alert(ids[0] + "-" + ids[1]);
			Tab(i.get('id'),ids[1]);
		});
	});
	}
});
function Tab(key,id){
//alert(id + "key " + key);
	$('tabs-nav').getElements('li').each(function(i) {
		i.set('id','#');
	})
	$(key).getParent().set('id','current');
	var req = new Request({
		url: 'views/staffcontroller.php?tab=' + key+'&idpersona='+id,
		method: 'get',
		onRequest: function() {
			$('cargando' + '-loading').set('html', '<img src=\'views/img/ajax-loader.gif\' width=\'16\' height=\'16\' alt=\'Loading\' /> Loading...');
	
		},
		onSuccess: function(responseText) {
			$('cargando' + '-loading').set('html','');
			$('tabs-content').set('html',responseText);
				new Asset.javascript('scriptaplicacion/AcordeonAnioPublicacionv2.js', {id: '6'});
			
		   }
	}).send();
}